Skip to content

Fix runtime versions for math.randomseed() - #1214

Merged
CppCXY merged 1 commit into
EmmyLuaLs:mainfrom
ligurio:ligurio/gh-xxxx-fix-randomseed
Aug 10, 2026
Merged

Fix runtime versions for math.randomseed()#1214
CppCXY merged 1 commit into
EmmyLuaLs:mainfrom
ligurio:ligurio/gh-xxxx-fix-randomseed

Conversation

@ligurio

@ligurio ligurio commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Fixes #1213

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this code change, I can provide the following review:

Summary

The change adds "JIT" to the version annotation for the math.randomseed function documentation in the Lua standard library definitions.

Analysis

What the change does

  • Adds JIT to the @version annotation for math.randomseed
  • This indicates that the function is available in LuaJIT in addition to Lua 5.1, 5.2, and 5.3

Potential Issues

  1. Incomplete documentation update: The change only updates the @version annotation but doesn't update the function description to mention any LuaJIT-specific behavior. LuaJIT's math.randomseed has some differences from standard Lua implementations (particularly regarding how it handles the seed value and the random number generator algorithm).

  2. Consistency concern: While math.randomseed exists in LuaJIT, it's worth verifying that all other functions in this file that are available in LuaJIT have also been properly annotated. If this is part of a larger effort to add LuaJIT support, there might be other functions that need similar updates.

  3. Version specificity: The annotation is somewhat ambiguous - LuaJIT has different versions (2.0, 2.1) and the annotation doesn't specify which LuaJIT versions support this function. However, math.randomseed has been available since early LuaJIT versions, so this is a minor concern.

Recommendations

  1. Consider updating the description: Add a note about LuaJIT-specific behavior if there are any differences in how math.randomseed works in LuaJIT compared to standard Lua.

  2. Check for completeness: If this is part of a broader effort to add LuaJIT support, ensure all other LuaJIT-compatible functions in the standard library files are also properly annotated.

  3. Consider more specific versioning: If LuaJIT has version-specific differences, you might want to use more specific annotations like "JIT 2.0+" or "JIT 2.1+" to be more precise.

Verdict

The change is technically correct and minimal - math.randomseed is indeed available in LuaJIT. The modification is safe and improves documentation accuracy. No blocking issues found, but consider the recommendations above for completeness.


--- @version 5.1, 5.2, 5.3
--- @version 5.1, 5.2, 5.3, JIT
---

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all Lua versions support it, you might as well just delete it directly ---@version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@ligurio
ligurio force-pushed the ligurio/gh-xxxx-fix-randomseed branch from 4c76e9a to ed6a064 Compare August 10, 2026 11:59
@CppCXY
CppCXY merged commit 4bea3ae into EmmyLuaLs:main Aug 10, 2026
16 checks passed
@ligurio
ligurio deleted the ligurio/gh-xxxx-fix-randomseed branch August 10, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

math.randomseed() should be accessible for LuaJIT

2 participants